<ui:composition template="/templates/layout.xhtml" xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:c="http://java.sun.com/jstl/core"
     xmlns:fmt="http://java.sun.com/jstl/fmt"
     xmlns:x="http://java.sun.com/jstl/xml"
     xmlns:fn="http://java.sun.com/jstl/functions"
     xmlns:a4j="http://richfaces.org/a4j"
     xmlns:rich="http://richfaces.org/rich"
     xmlns:gape="http://componentes.gape/component/gape">
     
	<ui:define name="titulo">
		<h:outputText value="#{msg.applicationName} - #{msg.tituloSWOT}" />
	</ui:define>

	<ui:define name="menu">
		<ui:include src="/menu/menuStrategicPlan.xhtml" />
	</ui:define>
	
	<ui:define name="conteudo">
		<h:panelGrid columns="4" columnClasses="label,field,imageLink" headerClass="pathway">
			<f:facet name="header">
				<h:outputText value="#{msg.tituloSWOT}" />
			</f:facet>
			<h:outputText value="#{msg.nameLabel}" />
			<h:inputText value="#{swot.name}" />
			<a4j:commandLink action="#" oncomplete="javascript:Richfaces.showModalPanel('panelAjuda');" reRender="panelAjuda" id="helpName" styleClass="imageLink">
				<h:graphicImage value="/files/help.png" />
			</a4j:commandLink>
			<rich:toolTip for="helpName" value="#{msg.helpToolTip}"/>				
			
			<h:outputText value="#{msg.descripionLabel}" />
			<h:inputTextarea value="#{swot.description}" cols="40" rows="4" />
			<a4j:commandLink action="#" oncomplete="javascript:Richfaces.showModalPanel('panelAjuda');" reRender="panelAjuda" id="helpDescription" styleClass="imageLink">
				<h:graphicImage value="/files/help.png" />
			</a4j:commandLink>
			<rich:toolTip for="helpDescription" value="#{msg.helpToolTip}"/>
		</h:panelGrid>
		
		<h:panelGrid columns="1" columnClasses="label">
			<rich:simpleTogglePanel switchType="client" label="#{msg.titlePanelAcronymPerspective}" opened="false">
				<rich:dataGrid columns="4" value="#{swot.listAcronymPerspective}" var="perspective" columnClasses="label,label,label,label" >
					<h:outputText value="#{perspective.acronym} - #{perspective.perspective}" />
				</rich:dataGrid>
			</rich:simpleTogglePanel>
		</h:panelGrid>

		<h:panelGrid columns="2" columnClasses="label, field" headerClass="pathway">
			<gape:gridSWOT id="strengthTable" elements="#{swot.listStrength}" header="#{msg.strengths}" action="#{swot.deleteItem}" selectedItem="#{swot.linhaSelecionada}" 
						   selectedItemTypeValue="#{1}" selectedItemTypeTarget="#{swot.selectedItemType}"/>
						   
			<gape:gridSWOT id="weaknessTable" elements="#{swot.listWeakness}" header="#{msg.weakness}" action="#{swot.deleteItem}" selectedItem="#{swot.linhaSelecionada}" 
						   selectedItemTypeValue="#{2}" selectedItemTypeTarget="#{swot.selectedItemType}"/>
						   
			<gape:gridSWOT id="opportunityTable" elements="#{swot.listOpportunity}" header="#{msg.opportunity}" action="#{swot.deleteItem}" selectedItem="#{swot.linhaSelecionada}" 
						   selectedItemTypeValue="#{3}" selectedItemTypeTarget="#{swot.selectedItemType}"/>

			<gape:gridSWOT id="threatTable" elements="#{swot.listThreat}" header="#{msg.threats}" action="#{swot.deleteItem}" selectedItem="#{swot.linhaSelecionada}" 
						   selectedItemTypeValue="#{4}" selectedItemTypeTarget="#{swot.selectedItemType}"/>				
		</h:panelGrid>
		
		<h:panelGrid columns="1">						
			<rich:messages layout="list" style="color: Red; align: Center; font-size: 15px"/>						
		</h:panelGrid>			
	</ui:define>
	
	<ui:define name="menuTela">
		<ui:include src="menu.xhtml" />
	</ui:define>
	
	<ui:define name="menuNavegacaoBack">
		<gape:navigationBack mbean="#{'menu'}" metodo="#{'redirecionaTela'}" parameterValue="stakeholders" parameterTarget="#{menu.menuCode}" />
	</ui:define>
	
	<ui:define name="menuNavegacaoForward">
		<gape:navigationForward mbean="#{'menu'}" metodo="#{'redirecionaTela'}" parameterValue="formulateStrategy" parameterTarget="#{menu.menuCode}" />
	</ui:define>	

	<ui:define name="includePanels">
		<ui:include src="panelNewItem.xhtml" />
		<ui:include src="panelAjuda.xhtml" />
	</ui:define>
</ui:composition>